/*
 * @Author: your name
 * @Date: 2020-10-13 18:05:14
 * @LastEditTime: 2020-11-15 20:39:06
 * @LastEditors: zhuhao
 * @Description: In User Settings Edit
 * @FilePath: \一键需求响应报表\src\apis\jxyzwg.js
 */
/*
 * 接口请求封装, xVue中 axios的拦截器是公用的,在这里重新封装
 * @param method
 * @param url
 * @param params
 * @param data
 * @returns {Promise<unknown>}
 */
function request ({
    method = 'get',
    url,
    params,
    data
}) {
    console.log('请求参数 >>> ', url)
    return new Promise(resolve => {
        window._xvueAxios({
            method,
            url,
            params,
            data,
        }).then(res => {
            const resData = res.data;
            if (resData.code === 0) {
                resolve(resData)
            } else {
                resolve(resData)
            }
        }).catch(err => {
            resolve(err);
        });
    })
}
export default {
    /**
     * 查询员工日收入详情复制文
     * @param params
     */
    getDailyIncomes (params) {
        return request({
            method: 'get',
            url: `/jxyzwg/income/summary/app`,
            // url: `/jxyzwg/income/summarys`,
            params,
        });
    },
    /**
     * 新增日收入信息
     * @param data
     */
    addDailyIncomes (data) {
        return request({
            method: 'post',
            url: `/jxyzwg/income/dailyIncomes`,
            data,
        });
    },
    /**
    * 修改日收入信息
    * @param data
    */
    editDailyIncomes (data) {
        return request({
            method: 'put',
            url: `/jxyzwg/income/dailyIncomes`,
            data,
        });
    },
    getUser () {
        return window._xvueAxios({
            method: 'get',
            url: `/jxyz/user`
        })
    }
};